package com.dreamcar.auction.entity;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * DestinationCarRelation entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "destination_car_relation", catalog = "assignment")
public class DestinationCarRelation implements java.io.Serializable {

	// Fields

	private DestinationCarRelationId id;
	private CarModel carModel;
	private DestinationMarket destinationMarket;

	// Constructors

	/** default constructor */
	public DestinationCarRelation() {
	}

	/** full constructor */
	public DestinationCarRelation(DestinationCarRelationId id,
			CarModel carModel, DestinationMarket destinationMarket) {
		this.id = id;
		this.carModel = carModel;
		this.destinationMarket = destinationMarket;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "destinationMarketIdDestinationMarket", column = @Column(name = "destination_market_ID_DESTINATION_MARKET", nullable = false)),
			@AttributeOverride(name = "carModelIdCarModel", column = @Column(name = "car_model_ID_CAR_MODEL", nullable = false)) })
	public DestinationCarRelationId getId() {
		return this.id;
	}

	public void setId(DestinationCarRelationId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "car_model_ID_CAR_MODEL", nullable = false, insertable = false, updatable = false)
	public CarModel getCarModel() {
		return this.carModel;
	}

	public void setCarModel(CarModel carModel) {
		this.carModel = carModel;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumn(name = "destination_market_ID_DESTINATION_MARKET", nullable = false, insertable = false, updatable = false)
	public DestinationMarket getDestinationMarket() {
		return this.destinationMarket;
	}

	public void setDestinationMarket(DestinationMarket destinationMarket) {
		this.destinationMarket = destinationMarket;
	}

}